<?php

class ProductController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }
    public function sideAction(){
    	echo "Hey!! - I am a sidebar";
    }

    public function indexAction()
    {
    	$this->view->content = "No Product provided - Please Select One";
    	
    }
    public function productDetailsAction(){
    	/*Get the parameters passed
    	 * Build query based on the value passed in type
    	 */
    	
    	if($this->_hasParam('id')){
    	$params = $this->_request->getParams();
    	require_once APPLICATION_PATH . '/models/db/db.php';
    	$db = db_db::db_con();
    	$sql_statement = "Select p.productid as productid, pd.description as description,
    					 pd3.description as l_description,an.name as an, pa.displayvalue as displayvalue from product p
    					 LEFT JOIN productdescriptions pd on p.productid = pd.productid and pd.type = 2
    					 LEFT JOIN productdescriptions pd3 on p.productid = pd3.productid and pd3.type = 3
    					 JOIN productattribute pa on p.productid = pa.productid and left(pa.attributeid,2) = 34
    					 and pa.localeid = 1
    					 JOIN attributenames an on pa.attributeid = an.attributeid and an.localeid = 1
    					 where p.productid =".$params['id'];
    			$result = $db->query($sql_statement);
    			$db->closeConnection();
    	$this->view->result = $result;
    	$this->view->sideBar = "This is the sidebar";
    	}
    }
    

}

